//
//  MOLYPicAVPlayerCollectionViewCell.h
//  WCImApp
//
//  Created by macMini on 2019/10/22.
//  Copyright © 2019 WCImApp. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "MOAlbumDetailItemModel.h"
#import "MOVideoLayer.h"
#import <AVFoundation/AVPlayerLayer.h>
#import <AVFoundation/AVPlayerItem.h>
#import "QAMessageFrame.h"
#import "MOClickRectExpandButton.h"
typedef void(^MOCloseBtnBlock)(void);
typedef void(^MOPlayBlock)(id cell);
@interface MOLYPicAVPlayerCollectionViewCell : UICollectionViewCell
/**
 *  播放器player
 */
@property (nonatomic, strong)AVPlayer       *player;
/**
 * playerLayer
 */
@property (nonatomic, strong)AVPlayerLayer  *playerLayer;

/**
 *  当前播放的item
 */
@property (nonatomic, strong)AVPlayerItem   *currentItem;
@property (nonatomic, strong) NSURL *fileUrl;

@property (nonatomic, strong) NSURLSessionDownloadTask *task;

/**
 *
 */
@property (nonatomic, copy) NSDictionary   *videoInfo;
@property (nonatomic, strong) UIImageView * previewImageV;
@property (nonatomic, strong) MOAlbumDetailItemModel *albumModel;

@property (nonatomic, weak)UIViewController  *comeController;

@property (nonatomic, copy) NSString *totleCountDown;
@property (nonatomic, strong) MOClickRectExpandButton *pauseButton;
// 记录视频在cell上位置
@property (nonatomic, assign) CGRect videoFrame;
@property (nonatomic, assign) CGRect layerFrame;

// 视频进度条底部view
@property (nonatomic, strong) UIView *pauseView;
@property (nonatomic, strong) MOVideoLayer *videoView;
@property (nonatomic, strong) QAMessageFrame *messageFrame;
@property (nonatomic, strong) MOCloseBtnBlock dismissBlock;
@property (nonatomic, strong) MOPlayBlock playBlock;
@property (nonatomic, assign) BOOL isDirectVideo;
@property (nonatomic, assign) BOOL directionChange;
@property (nonatomic, strong) NSIndexPath *indexPath;
//@property (nonatomic, assign) NSInteger currentIndex;
/**
 *  给一个本地视频url
 */
- (void)addPlayerURL:(NSURL *)URL andOriPath:(NSString *)orgUrl;
/**
 *  show player view
 */
- (void)setUpVideoView;
/** 暂停重置视频 */
- (void)stopAndStartPlayer;

/** 播放视频 */
- (void)playPlayer;

- (void)startPlayer;
- (void)stopPlayer;


- (void)releasePlayer;
@end


